package com.cy.pj.sys.web.pojo;

import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class JsonResult {
    private Integer state=1;//1表示Ok,0表示Exception
    /**状态信息*/
    private String message="ok";
    /**响应数据，一般为查询操作结果*/
    private Object data;

    public JsonResult(Object data) {
        this.data = data;
    }

    public JsonResult(String message) {
        this.message = message;
    }

    public JsonResult(Throwable e){
//        this.state=0;
//        this.message=e.getMessage();
        this(0,e.getMessage());
    }

    public JsonResult(Integer state, String message) {
        this.state = state;
        this.message = message;
    }


}
